#include <stdio.h>
#include <math.h>

double funcos(double e, double x);

int main()
{
    double e, x;

    scanf("%lf %lf", &e, &x);
    printf("cos(%.2f) = %.6f\n", x, funcos(e, x));

    return 0;
}

/* 你的代码将被嵌在这里 */
double funcos(double e, double x)
{
    double sum = 0.0;  // 累加和
    double term = 1.0; // 每一项的值
    int n = 0;         // 项数
    while (fabs(term) >= e)
    {
        sum += term;
        n++;
        term = -term * x * x / ((2 * n) * (2 * n - 1));
    }
    sum += term;
    return sum;
}